package com.yyh.mapper;

import com.yyh.entity.Modules;
import com.yyh.entity.Rolemodules;

import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yangyueheng
 * @since 2020-06-02
 */
public interface RolemodulesMapper extends BaseMapper<Rolemodules> {
	@Select("select module_id from rolemodules where role_id=#{roleId}")
	List<Integer> getModuleIdsByRoleId(Integer roleId);
	@Select("select * from modules where id in"
			+"(select module_id from rolemodules where role_id in"
			+"(select role_id from userroles where user_id =#{id}))")
	List<Modules> getModulesTreeByUserId(Integer uid);
}
